<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

    <!-- 满足有些用户在手机端访问的需要 -->

    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Expires" content="0">

    <title>用户管理</title>
    <!-- 线上环境 -->
    <link rel="stylesheet" href="/static/css/dist/component-min.css">
    <link rel="stylesheet" href="/static/plugins/jbox/jbox-min.css">

    <!--vue-->
    <script src="/static/vue/vue.js"></script>
    <!--element ui-->
    <script src="/static/element/index.js"></script>
    <link rel="stylesheet" href="/static/element/index.css">
    <style>
        .el-table__empty-block {
            height: 0;
        }
        .el-upload__files {
            display: none;
        }
        .img-delete:before {
            position: absolute;
            top: -5px;
            color: red;
            margin-left: -15px;
            z-index: 999;
        }
    </style>

</head>
<body class="cp-bodybox">
<div id="app">
    <#include "/common/header-fg.html" />

    <div class="container">
        <div class="inner clearfix">
            <#include "/common/left-menu-fg.html" />

            <div class="content-right">
                <h1 class="content-right-title">参数设置</h1>
                <el-tabs v-model="activeName" type="border-card" @tab-click="handleClick">
                    <el-tab-pane label="系统" name="SYS" v-if="isPermission('setting:system', user.permissions)">
                        <el-form :model="sysForm" label-width="80px">
                            <el-form-item label="logo">
                                <el-row>
                                    <img height="100" v-if="sysForm.imageUrl !== ''" :src="qiniuUrl + sysForm.imageUrl">
                                    <i class="el-icon-circle-close img-delete" v-if="sysForm.imageUrl !== ''" @click="deleteSysImg">
                                    </i>
                                    <el-upload
                                            :before-upload="beforeUpload"
                                            style="display: inline-block"
                                            :show-file-list="false"
                                            action="/file/upload"
                                            :on-success="uploadSuccess">
                                        <el-button size="small" type="primary">点击上传</el-button>
                                        <div slot="tip" class="el-upload__tip">只能上传jpg/png文件，且不超过500kb</div>
                                    </el-upload>
                                </el-row>
                            </el-form-item>
                            <el-form-item label="联系qq">
                                <el-input v-model="sysForm.linkQQ" style="width: 200px"></el-input>
                            </el-form-item>
                            <el-form-item label="标题">
                                <el-input v-model="sysForm.title" style="width: 200px"></el-input>
                            </el-form-item>
                        </el-form>
                        <div style="text-align: center">
                            <el-button type="primary" @click.native.prevent="save('SYS')">保存</el-button>
                            <el-button>取消</el-button>
                        </div>
                    </el-tab-pane>
                    <el-tab-pane label="积分" name="POINT" v-if="isPermission('setting:point', user.permissions)">
                        <el-form :model="pointForm" label-width="160px">
                            <el-form-item label="积分抵扣比例">
                                <el-input v-model="pointForm.pointRate" style="width: 50px;"></el-input>&nbsp;元
                            </el-form-item>
                            <el-form-item label="兑换次数">
                                <el-row>
                                    <el-radio-group v-model="pointForm.pointTimeUnit" style="margin-top: 10px">
                                        <el-radio label="1">每天</el-radio>
                                        <el-radio label="2">每周</el-radio>
                                        <el-radio label="3">每月</el-radio>
                                    </el-radio-group>
                                    <el-input v-model="pointForm.pointTotalTime" style="width: 50px;"></el-input>&nbsp;次
                                </el-row>
                            </el-form-item>
                            <el-form-item label="兑换总额度">
                                <el-row>
                                    <el-radio-group v-model="pointForm.pointTotalUnit">
                                        <el-radio label="1">每天</el-radio>
                                        <el-radio label="2">每周</el-radio>
                                        <el-radio label="3">每月</el-radio>
                                    </el-radio-group>
                                    <el-input v-model="pointForm.pointTotalMax" style="width: 50px"></el-input>&nbsp;积分
                                </el-row>
                            </el-form-item>
                            <el-form-item label="单次兑换额度">
                                最小&nbsp;<el-input v-model="pointForm.pointMin" style="width: 50px"></el-input>&nbsp;&nbsp;&nbsp;
                                最大&nbsp;<el-input v-model="pointForm.pointMax" style="width: 50px"></el-input>
                            </el-form-item>
                            <el-form-item label="额外申请兑换额度">
                                最小&nbsp;<el-input v-model="pointForm.pointExtraMin" style="width: 100px"></el-input>&nbsp;&nbsp;&nbsp;
                                最大&nbsp;<el-input v-model="pointForm.pointExtraMax" style="width: 100px"></el-input>
                            </el-form-item>
                        </el-form>
                        <div style="text-align: center">
                            <el-button type="primary" @click.native.prevent="save('POINT')">保存</el-button>
                            <el-button>取消</el-button>
                        </div>
                    </el-tab-pane>
                    <el-tab-pane label="余额" name="BALANCE" v-if="isPermission('setting:balance', user.permissions)">
                        <el-form :model="balanceForm" label-width="120px">
                            <el-form-item label="提现次数">
                                <el-row>
                                    <el-radio-group v-model="balanceForm.balanceEftchUnit" style="margin-top: 10px">
                                        <el-radio label="1">每天</el-radio>
                                        <el-radio label="2">每周</el-radio>
                                        <el-radio label="3">每月</el-radio>
                                    </el-radio-group>
                                    <el-input v-model="balanceForm.balanceEftchTimes" style="width: 50px;"></el-input>&nbsp;次
                                </el-row>
                            </el-form-item>
                            <el-form-item label="单次提现额度">
                                最小&nbsp;<el-input v-model="balanceForm.balanceEftchMin" style="width: 50px"></el-input>&nbsp;&nbsp;&nbsp;
                                最大&nbsp;<el-input v-model="balanceForm.balanceEftchMax" style="width: 50px"></el-input>
                            </el-form-item>
                        </el-form>
                        <div style="text-align: center">
                            <el-button type="primary" @click.native.prevent="save('BALANCE')">保存</el-button>
                            <el-button>取消</el-button>
                        </div>
                    </el-tab-pane>
                    <el-tab-pane label="签到" name="SIGNED" v-if="isPermission('setting:sign', user.permissions)">
                        <el-form :model="signedForm" label-width="80px">
                            <el-form-item label="图片">
                                <el-row>
                                    <img height="100" v-if="signedForm.signedLogo !== ''" :src="qiniuUrl + signedForm.signedLogo">
                                    <i class="el-icon-circle-close img-delete" v-if="signedForm.signedLogo !== ''" @click="deleteSignedImg">
                                    </i>
                                    <el-upload
                                            :before-upload="beforeUpload"
                                            style="display: inline-block"
                                            :show-file-list="false"
                                            action="/file/upload"
                                            :on-success="uploadSignedSuccess">
                                        <el-button size="small" type="primary">点击上传</el-button>
                                        <div slot="tip" class="el-upload__tip">只能上传jpg/png文件，且不超过500kb</div>
                                    </el-upload>
                                </el-row>
                            </el-form-item>
                        </el-form>
                        <el-card class="box-card">
                            <div slot="header" class="clearfix">
                                <span style="line-height: 36px;">签到规则列表</span>
                                <el-button style="float: right;" type="primary" @click.native.prevent="addSignedRules">添加</el-button>
                            </div>
                            <div>
                                <el-table
                                        :data="signedForm.rules"
                                        border
                                        style="width: 100%">
                                    <el-table-column
                                            label="序号"
                                            type="index"
                                            align="center"
                                            width="80">
                                    </el-table-column>
                                    <el-table-column
                                            prop="type"
                                            align="center"
                                            :formatter="formatType"
                                            label="类型">
                                    </el-table-column>
                                    <el-table-column
                                            prop="days"
                                            align="center"
                                            label="签到天数">
                                    </el-table-column>
                                    <el-table-column
                                            inline-template
                                            align="center"
                                            label="奖励积分">
                                        <div v-if="row.awardPointMin">{{row.awardPointMin}}&nbsp;-&nbsp;{{row.awardPointMax}}</div>
                                        <div v-else>{{row.awardPointMax}}</div>
                                    </el-table-column>
                                    <el-table-column
                                            align="center"
                                            label="操作"
                                            inline-template>
                                        <div style="margin-left: -10px">
                                            <el-dropdown>
                                                <el-button size="small" type="primary">
                                                    操作<i class="el-icon-caret-bottom el-icon--right"></i>
                                                </el-button>
                                                <el-dropdown-menu slot="dropdown" align="center">
                                                    <el-dropdown-item><el-button size="mini" type="primary" class="el-icon-edit" @click.native.prevent="editSignedRules(row, $index)">编辑</el-button></el-dropdown-item>
                                                    <el-dropdown-item><el-button size="mini" type="primary" class="el-icon-delete" @click.native.prevent="deleteSignedRules($index)">删除</el-button></el-dropdown-item>
                                                </el-dropdown-menu>
                                            </el-dropdown>
                                        </div>
                                    </el-table-column>
                                </el-table>
                            </div>
                        </el-card>
                        <div style="text-align: center;margin-top: 10px">
                            <el-button type="primary" @click.native.prevent="save('SIGNED')">保存</el-button>
                            <el-button>取消</el-button>
                        </div>
                    </el-tab-pane>
                    <el-tab-pane label="分销" name="DISTRIBUTION" v-if="isPermission('setting:sale', user.permissions)">
                        <el-form label-width="80px">
                            <el-form-item>
                                <el-tag
                                        style="margin: 5px"
                                        :key="index"
                                        v-for="(tag, index) in distributionData"
                                        :closable="true"
                                        type="primary"
                                        @close="deleteTag(index)"
                                >
                                    积分{{tag.index}}层返回{{tag.rate}}%{{tag.type === 1 ? "金额" : "积分"}}
                                </el-tag>
                            </el-form-item>
                            <el-form-item>
                                <el-input v-model="distributionForm.index" placeholder="分销层数" style="width: 100px"></el-input>&nbsp;&nbsp;
                                <el-input v-model="distributionForm.rate" placeholder="返回比例" style="width: 100px"></el-input>&nbsp;%&nbsp;&nbsp;
                                <el-select v-model="distributionForm.type" placeholder="请选择类型" style="width: 120px">&nbsp;&nbsp;&nbsp;
                                    <el-option
                                            v-for="item in distributionType"
                                            :label="item.label"
                                            :value="item.value">
                                    </el-option>
                                </el-select>
                                <el-button type="primary" @click.native.prevent="addDistribution">添加</el-button>
                            </el-form-item>
                        </el-form>
                        <div style="text-align: center">
                            <el-button type="primary" @click.native.prevent="saveDistribution">保存</el-button>
                            <el-button>取消</el-button>
                        </div>
                    </el-tab-pane>
                    <el-tab-pane label="订单" name="ORDER" v-if="isPermission('setting:order', user.permissions)">
                        <el-form :model="orderForm" label-width="120px">
                            <el-form-item label="短信通知商家">
                                <el-switch on-text="" off-text="" v-model="orderForm.orderMessage" style="margin-top: 5px"></el-switch>
                            </el-form-item>
                        </el-form>
                        <div style="text-align: center">
                            <el-button type="primary" @click.native.prevent="save('ORDER')">保存</el-button>
                            <el-button>取消</el-button>
                        </div>
                    </el-tab-pane>
                    <el-tab-pane label="客户生日提醒" name="BIRTH" v-if="isPermission('setting:birth', user.permissions)">

                        <el-form :model="birthForm" label-width="120px">
                            <el-form-item>
                                提前&nbsp;&nbsp;<el-input v-model="birthForm.birthdayAdvanceDays" style="width: 50px"></el-input>&nbsp;&nbsp;天&nbsp;&nbsp;
                                <template>
                                    <el-time-select
                                            v-model="birthForm.birthdayRemindTime"
                                            :picker-options="{
                                    start: '00:00',
                                    step: '01:00',
                                    end: '23:00'
                                  }"
                                            placeholder="请选择时间">
                                    </el-time-select>&nbsp;&nbsp;发送生日提醒
                                </template>
                            </el-form-item>
                            <!--<el-form-item>-->
                                <!--生日当天&nbsp;-->
                                <!--<el-time-picker-->
                                    <!--v-model="birthForm.time"-->
                                    <!--:picker-options="{-->
                                      <!--selectableRange: '18:30:00 - 20:30:00'-->
                                    <!--}"-->
                                    <!--placeholder="请选择时间">&nbsp;发送生日短信-->
                                <!--</el-time-picker>-->
                            <!--</el-form-item>-->
                            <!--<el-form-item>-->
                                <!--生日祝福模板&nbsp;-->
                                <!--<el-input-->
                                    <!--type="textarea"-->
                                    <!--:rows="2"-->
                                    <!--style="width: 300px"-->
                                    <!--placeholder="请输入内容"-->
                                    <!--v-model="birthForm.textarea">-->
                                <!--</el-input>&nbsp;-->
                                <!--<el-select v-model="birthForm.pointMin" placeholder="请选择参数" style="width: 120px">-->
                                    <!--<el-option-->
                                            <!--v-for="item in options"-->
                                            <!--:label="item.label"-->
                                            <!--:value="item.value">-->
                                    <!--</el-option>-->
                                <!--</el-select>-->
                            <!--</el-form-item>-->
                        </el-form>
                        <div style="text-align: center">
                            <el-button type="primary" @click.native.prevent="save('BIRTH')">保存</el-button>
                            <el-button>取消</el-button>
                        </div>
                    </el-tab-pane>
                </el-tabs>
                <el-dialog :title="rulesTitle" v-model="addSignedRulesDialog">
                    <el-form :model="rulesForm" :rules="rules" ref="rulesForm" label-width="80px">
                        <el-form-item label="类型">
                            <el-radio-group v-model="rulesForm.type" style="margin-top: 8px">
                                <el-radio :label="1">固定天数奖励</el-radio>
                                <el-radio :label="2">平均/没满天数奖励</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="天数" prop="days">
                            <el-input v-model.number="rulesForm.days" style="width: 200px"></el-input>&nbsp;天
                        </el-form-item>
                        <el-row>
                            <el-col :span="8">
                                <el-form-item label="积分" prop="awardPointMin">
                                    <el-input style="width: 200px;margin-right: 10px" v-model.number="rulesForm.awardPointMin"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="1">
                                <label class="el-form-item__label">至</label>
                            </el-col>
                            <el-col :span="6">
                                <el-form-item prop="awardPointMax" label-width="0">
                                    <el-input style="width: 200px" v-model.number="rulesForm.awardPointMax"></el-input>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <!--<el-form-item label="积分" prop="awardPointMax">-->
                            <!--<div v-if="rulesForm.type !== 1" style="display: inline-block">-->
                                <!--<el-input style="width: 200px" v-model="rulesForm.awardPointMin"></el-input>&nbsp;<span>-</span>&nbsp;-->
                            <!--</div>-->
                            <!--<el-input style="width: 200px" v-model.number="rulesForm.awardPointMax"></el-input>-->
                        <!--</el-form-item>-->
                    </el-form>

                    <div slot="footer" class="dialog-footer" style="text-align: center">
                        <el-button @click="cancelSignedRules">取 消</el-button>
                        <el-button type="primary" @click="saveSignedRules">确 定</el-button>
                    </div>
                </el-dialog>
            </div>
            <!-- end content-right -->

            <a href="javascript:;" class="btn-leftMenuFold" id="j-btn-leftMenuFold"></a>
        </div>
    </div>
    <!-- end container -->

    <!--gonggao-->

    <!--tip-->
    <div class="footer">© 2017 , Inc. All rights reserved.</div>
    <!-- end footer -->
    <div class="fixedBar" style="right: -78px;">
        <ul>
            <template v-for="(item, index) in leftMenuList">
                <li v-if="index==0" :class="'shopManager' + index + ' cur'"><a href="javascript:;" :data-target="'#shop_' + index">{{item.groupName}}</a></li>
                <li v-else :class="'shopManager' + index"><a href="javascript:;" :data-target="'#shop_' + index">{{item.groupName}}</a></li>
            </template>
        </ul>
        <a href="javascript:;" class="fixedBar-btn" id="j-fixedBar-btn"></a>
    </div>
    <a href="#" id="j-gotop" class="gotop" title="回到顶部" style="left: 1920.59px;"></a>

</div>
<script src="/static/js/dist/lib-min.js"></script>
<script src="/static/js/dist/list.js"></script>
<script src="/static/js/dist/component-min.js"></script>

<!-- 引入api -->
<script src="/static/js/api.js"></script>
<script>
    new Vue({
        el: '#app',
        data: function(){
            return {
                user: ${(user)!'null'},
                options: [],
                rules: {
                    days: [
                        {required: true, message: "请输入天数"},
                        {type: "integer", message: '天数必须为整数'}
                    ],
                    awardPointMin: [
                        {required: true, message: "请输入积分数"},
                        {type: "integer", message: '积分数必须为整数'}
                    ],
                    awardPointMax: [
                        {required: true, message: "请输入积分数"},
                        {type: "integer", message: '积分数必须为整数'}
                    ]
                },
                distributionType: [
                    {
                        label: '金额',
                        value: 1
                    },
                    {
                        label: '积分',
                        value: 2
                    }
                ],
                qiniuUrl: list.qiniuUrl,
                rulesTitle: '新增签到规则',
                rulesIndex: '',
                addSignedRulesDialog: false,
                activeName: 'SYS',
                headerNavList: list.headerNavList,
                accountNavList: list.accountNavList,
                leftMenuList: list.menu,
                sysForm: {
                    type: "",
                    imageUrl: '',
                    linkQQ: '',
                    title: ''
                },
                pointForm: {
                    type: '',
                    pointRate: '',
                    pointTotalTime: '',
                    pointTimeUnit: '',
                    pointTotalMax: '',
                    pointTotalUnit: '',
                    pointMax: '',
                    pointMin: '',
                    pointExtraMin: '',
                    pointExtraMax: ''
                },
                balanceForm: {
                    type: '',
                    balanceEftchMax: '',
                    balanceEftchMin: '',
                    balanceEftchTimes: '',
                    balanceEftchUnit: ''
                },
                orderForm: {
                    type: '',
                    orderMessage: false
                },
                signedForm: {
                    type: '',
                    signedLogo: '',
                    rules: [
                        {
                            days: '3',
                            awardPointMin: '2',
                            awardPointMax: '10',
                            type: ''
                        }
                    ]
                },
                rulesForm: {
                    type: '',
                    days: '',
                    awardPointMin: '',
                    awardPointMax: ''
                },
                distributionData: [
                    {
                        index: 1,
                        type: 1,
                        rate: 10
                    }
                ],
                distributionForm: {
                    index: '',
                    type: '',
                    rate: ''
                },
                birthForm: {
                    type: "",
                    birthdayAdvanceDays: "",
                    birthdayRemindTime: ""
                },
                url: '',
                imgType: ''
            }
        },
        mounted: function () {
            this.getDetail("SYS");
        },
        methods: {
            beforeUpload (file) {
                if (file.type === "image/png") {
                    this.imgType = ".png";
                    return true;
                } else if (file.type === "image/jpeg") {
                    this.imgType = ".jpg";
                    return true;
                } else {
                    this.$message.error('上传头像图片只能是 JPG 或 png 格式!');
                    return false;
                }
            },
            formatType (row, column) {
                if (row.type === 1) {
                    return "固定天数奖励";
                } else {
                    return "平均/没满天数奖励";
                }
            },
            deleteSysImg () {
                this.sysForm.imageUrl = "";
            },
            deleteSignedImg () {
                this.signedForm.signedLogo = "";
            },
            addDistribution () {
                if (this.distributionForm.index === "" || this.distributionForm.type === "" || this.distributionForm.rate === "") {
                    this.$alert('请填写数据', '提示', {
                        confirmButtonText: '确定',
                    });
                    return;
                }
                this.distributionData.push(this.distributionForm);
                this.distributionForm = {
                    index: '',
                    type: '',
                    rate: ''
                }
            },
            addSignedRules () {
                this.rulesForm = {
                    type: '',
                    days: '',
                    awardPointMin: '',
                    awardPointMax: ''
                }
                this.rulesTitle = "新增签到规则";
                this.addSignedRulesDialog = true;
            },
            editSignedRules (row, index) {
                this.rulesForm = row;
                this.rulesTitle = "编辑签到规则";
                this.addSignedRulesDialog = true;
                this.rulesIndex = index;
            },
            deleteSignedRules (index) {
                this.signedForm.rules.splice(index, 1);
            },
            cancelSignedRules () {
                this.$refs.rulesForm.resetFields();
                this.addSignedRulesDialog = false;
            },
            saveSignedRules () {
                let isValid = true;
                this.$refs.rulesForm.validate(function (valid) {
                    if (!valid) {
                        isValid = false;
                    }
                });
                if (isValid) {
                    let obj = {
                        type: this.rulesForm.type,
                        days: parseInt(this.rulesForm.days),
                        awardPointMin: this.rulesForm.awardPointMin === "" ? "" : parseInt(this.rulesForm.awardPointMin),
                        awardPointMax: parseInt(this.rulesForm.awardPointMax)
                    }
                    if (this.rulesTitle === "编辑签到规则") {
                        this.signedForm.rules[this.rulesIndex] = obj;
                    } else {
                        this.signedForm.rules.push(obj);
                    }
                    this.$refs.rulesForm.resetFields();
                    this.addSignedRulesDialog = false;
                } else {
                    this.$message.error('请完善信息');
                }
            },
            handleClick(tab, event) {
                console.log(tab.name);
                let type = tab.name;
                if (type === "SYS") {
                    if (this.sysForm.type === "") {
                        this.getDetail(type);
                    }
                } else if (type === "POINT") {
                    if (this.pointForm.type === "") {
                        this.getDetail(type);
                    }
                } else if (type === "BALANCE") {
                    if (this.balanceForm.type === "") {
                        this.getDetail(type);
                    }
                } else if (type === "SIGNED") {
                    if (this.signedForm.type === "") {
                        this.getDetail(type);
                    }
                } else if (type === "ORDER") {
                    if (this.orderForm.type === "") {
                        this.getDetail(type);
                    }
                } else if (type === "DISTRIBUTION") {
                    if (this.distributionForm.type === "") {
                        this.getDistributionDetail(type);
                    }
                } else if (type === "BIRTH") {
                    if (this.birthForm.type === "") {
                        this.getDetail(type);
                    }
                }
            },
            uploadSuccess (response, file) {
                if (response.status === 100) {
                    this.sysForm.imageUrl = response.returnValue[0].id + this.imgType;
                } else {
                    this.$alert('上传失败', '提示', {
                        confirmButtonText: '确定',
                    });
                }
            },
            uploadSignedSuccess (response, file) {
                if (response.status === 100) {
                    this.signedForm.signedLogo = response.returnValue[0].id + this.imgType;
                } else {
                    this.$alert('上传失败', '提示', {
                        confirmButtonText: '确定',
                    });
                }
            },
            deleteTag (index) {
                this.distributionData.splice(index, 1);
            },
            save (type) {
                let that = this;
                let obj = {};
                if (type === "SYS") {
                    this.sysForm.type = "SYS";
                    obj = {
                        type: this.sysForm.type,
                        sysLogo: this.sysForm.imageUrl,
                        sysTitle: this.sysForm.title,
                        sysQQ: this.sysForm.linkQQ
                    }
                } else if (type === "POINT") {
                    this.pointForm.type = "POINT";
                    obj = this.pointForm;
                } else if (type === "BALANCE") {
                    this.balanceForm.type = "BALANCE";
                    obj = this.balanceForm;
                } else if (type === "SIGNED") {
                    this.signedForm.type = "SIGNED";
                    obj = this.signedForm;
                } else if (type === "ORDER") {
                    this.orderForm.type = "ORDER";
                    obj = {
                        type: "ORDER",
                        orderMessage: this.orderForm.orderMessage ? "1" : "0"
                    }
                } else if (type === "BIRTH") {
                    this.birthForm.type = "BIRTH";
                    obj = this.birthForm;
                }
                let loading = this.$loading({fullscreen: true, lock: true, text: '保存中'});
                this.http("/appParam/updateAppParam", obj, function (res) {
                    if (res.status === 200) {
                        loading.close();
                        that.$alert('保存成功', '提示', {
                            confirmButtonText: '确定',
                        });
                    } else {
                        loading.close();
                        that.$alert('保存失败', '提示', {
                            confirmButtonText: '确定',
                        });
                    }
                }, function (res) {
                    loading.close();
                    that.$alert('保存失败', '提示', {
                        confirmButtonText: '确定',
                    });
                })
            },
            getDetail (code) {
                let that = this;
                let loading = this.$loading({fullscreen: true, lock: true, text: '加载中'});
                this.http("/appParam/appParamsList", {code: code}, function (res) {
                    if (res.status === 200) {
                        let data = res.data.appParam;
                        if (code === "SYS") {
                            that.url = data.sysLogo;
                            that.sysForm = {
                                type: "SYS",
                                linkQQ: data.sysQQ,
                                title: data.sysTitle,
                                imageUrl: data.sysLogo
                            }
                        } else if (code === "POINT") {
                            that.pointForm = data;
                            that.pointForm.type = "POINT";
                        } else if (code === "BALANCE") {
                            that.balanceForm = data;
                            that.balanceForm.type = "BALANCE";
                        } else if (code === "ORDER") {
                            that.orderForm = {
                                type: "ORDER",
                                orderMessage: data.orderMessage === "1" ? true : false
                            }
                        } else if (code === "BIRTH") {
                            that.birthForm = data;
                            that.birthForm.type = "BIRTH";
                        } else if (code === "SIGNED") {
                            that.signedForm = data;
                            that.signedForm.type = "SIGNED";
                        }
                        loading.close();
                    } else {
                        loading.close();
                        that.$alert('服务器错误', '提示', {
                            confirmButtonText: '确定',
                        });
                    }
                }, function (res) {
                    loading.close();
                    that.$alert('服务器错误', '提示', {
                        confirmButtonText: '确定',
                    });
                })
            },
            getDistributionDetail () {
                let that = this;
                let loading = this.$loading({fullscreen: true, lock: true, text: '加载中'});
                this.http("/appParam/distributionParam", {code: 'DISTRIBUTION'}, function (res) {
                    if (res.status === 200) {
                        that.distributionData = res.data.distributionList
                        loading.close();
                    } else {
                        loading.close();
                        that.$alert('服务器错误', '提示', {
                            confirmButtonText: '确定',
                        });
                    }
                }, function (res) {
                    loading.close();
                    that.$alert('服务器错误', '提示', {
                        confirmButtonText: '确定',
                    });
                })
            },
            saveDistribution () {
                let that = this;
                let loading = this.$loading({fullscreen: true, lock: true, text: '保存中'});
                this.http("/appParam/updateDistributionAppParam", this.distributionData, function (res) {
                    if (res.status === 200) {
                        loading.close();
                        that.$alert('保存成功', '提示', {
                            confirmButtonText: '确定',
                        });
                    } else {
                        loading.close();
                        that.$alert('保存失败', '提示', {
                            confirmButtonText: '确定',
                        });
                    }
                }, function (res) {
                    loading.close();
                    that.$alert('保存失败', '提示', {
                        confirmButtonText: '确定',
                    });
                })
            }
        }
    })
</script>

<!-- 20170105 --></body>
</html>